using UnityEngine;
public class PlayerCtrl : MonoBehaviour
{
    public RoleInfo role;
    void Update()
    {
        if (role != null)
        {
            if (Input.GetKeyDown(KeyCode.Alpha1)) role.setGun(0); //按1切换手枪
            if (Input.GetKeyDown(KeyCode.Alpha2)) role.setGun(1); //按2切换机枪
            if (Input.GetKeyDown(KeyCode.Alpha3)) role.setGun(2); //按3切换火箭筒
            if (Input.GetKeyDown(KeyCode.Alpha4)) role.setGun(3); //按4切换手雷

            if (Input.GetMouseButtonDown(0)) role.SetFire(true); //鼠标左键按下
            if (Input.GetMouseButtonUp(0)) role.SetFire(false); //鼠标左键松开

            float h = Input.GetAxis("Horizontal");
            float v = Input.GetAxis("Vertical");
            role.Move(h, v); //控制移动
        }
    }
}